#ifndef __UTILS_CHECK_H__
#define __UTILS_CHECK_H__

#include "utils_print.h"
#include <sys/errno.h>
#include <string.h>

#define UTILS_CHK_RET(a, b) \
    do{ if(a != b){ return; } } while(0)

#define UTILS_CHK_RETCODE(a, b, ret) \
    do{ if(a != b){ return ret; } } while(0)

#define UTILS_CHK_RET_PERROR(a, b, level, errString) \
    do{ if(a != b){ \
            utils_print_error(level, errString" %s\n", strerror(errno)); \
            return; } } while(0)

#define UTILS_CHK_RETCODE_PERROR(a, b, ret, level, errString) \
    do{ if(a != b){ \
            utils_print_error(level, errString" %s\n", strerror(errno)); \
            return ret; } } while(0)


#endif // __UTILS_CHECK_H__
